# Contributor: lauren n. liberda <lauren@selfisekai.rocks>
# Maintainer: lauren n. liberda <lauren@selfisekai.rocks>
pkgname=oauth2-proxy
pkgver=7.6.0
pkgrel=6
pkgdesc="Reverse proxy that provides authentication with Google, Azure, OpenID Connect and many more identity providers"
url="https://oauth2-proxy.github.io/oauth2-proxy"
arch="all"
license="MIT"
install="$pkgname.pre-install"
makedepends="go"
subpackages="$pkgname-openrc"
source="
	https://github.com/oauth2-proxy/oauth2-proxy/archive/v$pkgver/oauth2-proxy-$pkgver.tar.gz

	oauth2-proxy.initd
	oauth2-proxy.confd

	make-dont-disable-cgo.patch
	"
options="net"

build() {
	VERSION="$pkgver" make oauth2-proxy
}

check() {
	go test ./...
}

package() {
	install -Dm755 oauth2-proxy "$pkgdir"/usr/bin/oauth2-proxy
	install -Dm755 "$srcdir"/oauth2-proxy.initd "$pkgdir"/etc/init.d/oauth2-proxy
	install -Dm755 "$srcdir"/oauth2-proxy.confd "$pkgdir"/etc/conf.d/oauth2-proxy
	install -Dm644 contrib/oauth2-proxy.cfg.example "$pkgdir"/etc/oauth2-proxy/oauth2-proxy.cfg
}

sha512sums="
de7574ae6ecf0da0b9962e4601fdc5b7f742fa0d4a55a0e5844256a2aa10170973c324b1041c490b2be0023b954a53d9b78ed488dcd238a2a047e25ab5ba7667  oauth2-proxy-7.6.0.tar.gz
4f91d8bff4ced7fca4d0795c2a0a89e0c8cb28f981db435f30b30f122757b8fe9d855a0d4d87497becedc543cdf48d20f3bc7813728bffaeac891d927157a237  oauth2-proxy.initd
56ec244414ecc96cad80b7c3f231c9e437350046ec80edc3661753bf24e194c51472acf2b097d893f3aed4200b0304e20e9c4d6edd05d698ff54524137c726e7  oauth2-proxy.confd
783bd07239d36e8913836f2f1970e1603ae43d58e643b689fa9d6abaeaf6b34c5e0e250bd13fefecf7b43c45b66cb54170b9f8b913d35d6def28dcb6ea3a5489  make-dont-disable-cgo.patch
"
